import Vue from 'vue'
import VueI18N from 'vue-i18n'
import Cookie from 'js-cookie'

Vue.use(VueI18N)
// 引入中文和英文的饿了么包
import elementZH from 'element-ui/lib/locale/lang/zh-CN'
import elementEH from 'element-ui/lib/locale/lang/en'
// 引入自定义语言包
import customZH from './zh'
import customEN from './en'

export default new VueI18N({
  locale: Cookie.get('language') || 'zh',

  messages: {
    zh: {
      hello: '祝你开心每一天！',
      morning: '早安',
      'confirmDel': '是否确认删除?',
      ...elementZH,
      ...customZH
    },
    en: {
      hello: 'have a good day',
      morning: 'Good morning',
      'confirmDel': 'Are you sure?',
      ...elementEH,
      ...customEN
    }
  }
})
